'use strict'

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    const { INTEGER, STRING, DATE, BOOLEAN } = Sequelize

    await queryInterface.createTable('tags', {
      id: {
        type: INTEGER(20).UNSIGNED,
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        comment: '主键id'
      },
      tag: {
        type: STRING(20),
        allowNull: false,
        comment: '标签名称'
      },
      status: {
        type: BOOLEAN,
        allowNull: false,
        defaultValue: 1,
        comment: '状态 1:正常 0:删除'
      },
      type: {
        type: STRING(20),
        allowNull: false,
        range: ['works', 'photo'],
        comment: '标签类型'
      },
      created_at: DATE,
      updated_at: DATE
    })
  },
  async down(queryInterface) {
    queryInterface.dropTable('tags')
  }
}
